package com.msh.artascope.devcloud.client.po;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.msh.artascope.interfaces.ILoginAccount;
import com.msh.frame.client.base.BasePo;
import com.msh.frame.client.validation.IDeleteVo;
import com.msh.frame.client.validation.IInsertVo;
import com.msh.frame.client.validation.IUpdateVo;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Date;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * @author shihu
 * @email m-sh@qq.com
 */
@Data
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Schema(title = "制品反向代理Po")
public class ModuleReverseProxyPo extends BasePo {

  /**
   * 主键
   */
  @NotNull(groups = {IUpdateVo.class, IDeleteVo.class}, message = "id不能为空")
  @Schema(title = "主键")
  private Long id;

  /**
   * 项目id
   */
  @Schema(title = "项目id")
  private Long projectId;

  /**
   * 模块id
   */
  @NotNull(groups = {IInsertVo.class}, message = "模块id不能为空")
  @Schema(title = "模块id")
  private Long moduleId;

  /**
   * 域名配置id
   */
  @NotNull(groups = {IInsertVo.class}, message = "域名配置id不能为空")
  @Schema(title = "域名配置id")
  private Long domainConfigId;

  /**
   * 访问路径
   */
  @Size(groups = {IUpdateVo.class,
      IInsertVo.class}, max = 100, message = "requestPath长度范围最大100")
  @Schema(title = "访问路径")
  private String requestPath;

  /**
   * 应用路径
   */
  @Size(groups = {IUpdateVo.class, IInsertVo.class}, max = 100, message = "appPath长度范围最大100")
  @Schema(title = "应用路径")
  private String appPath;

  /**
   * 环境
   */
  @Schema(title = "环境")
  private Long envId;

  /**
   * 租户
   */
  @Schema(title = "租户")
  private Long tenantId;

  /**
   * 更新版本
   */
  @NotNull(groups = {IUpdateVo.class}, message = "更新版本不能为空")
  @Schema(title = "更新版本")
  private Integer updateVersion;

  /**
   * 创建时间
   */
  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @Schema(title = "创建时间")
  private Date createTime;

  /**
   * 更新时间
   */
  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @Schema(title = "更新时间")
  private Date updateTime;


  public void initLoginAccount(ILoginAccount loginAccount) {
    this.tenantId = loginAccount.getTenantId();
  }
}



